#include <windows.h>
#include <tchar.h>
#include <commctrl.h>
#include <math.h>
#include "resource.h"
#include "CWindowViewer.h"
#include "Win32Utils/CStrUtils.h"
#include "Win32Utils/CDumpUtils.h"
#include "Win32Utils/CPathUtils.h"
#include "CWindowFrame.h"

int WINAPI WinMain(
    _In_ HINSTANCE hInstance,
    _In_opt_ HINSTANCE hPrevInstance,
    _In_ LPSTR lpCmdLine,
    _In_ int nShowCmd)
{
    UNREFERENCED_PARAMETER(hInstance);
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);
    UNREFERENCED_PARAMETER(nShowCmd);

    CDumpUtils::Install();

    INITCOMMONCONTROLSEX data = { 0 };
    data.dwSize = sizeof(data);

    ::InitCommonControlsEx(&data);
    CWindowFrame wnd;
    wnd.Register(_T("Chr_Viewer"));

    HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MENU));
    DWORD dwStyle = WS_OVERLAPPEDWINDOW;
    wnd.Create(nullptr, hMenu, _T("CHR Viewer"), SW_SHOW, dwStyle, 0, 0, 0, 640, 640);
    wnd.ShowWindow();
    wnd.Run();

    return 0;
}
